﻿  <%@ Page Title="" Language="C#" MasterPageFile="~/HomeMain.master" AutoEventWireup="true" CodeFile="ForumRaoVat.aspx.cs" Inherits="ForumRaoVat" %>

<%@ Register Src="~/Controls/BVDienDan.ascx" TagPrefix="uc1" TagName="BVDienDan" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
                        <div class="row">
                <div class="col-md-12">
                    <ul class="breadcrumb">
                        <li>
                            <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/Default.aspx"><span class="glyphicon glyphicon-home"></span></asp:HyperLink>
                          </li>
                        <li>
                            <asp:HyperLink ID="linkcrumTEN" runat="server" Text="Diễn Đàn Rao Vặt"></asp:HyperLink></li>
                    </ul>
                </div>
            </div>
    <div class="row">
      <div class="col-md-12">
          <div class="row">
              <div class="col-md-12 ">
                  <asp:HyperLink ID="HyperLink2" runat="server" CssClass="btn btn-danger pull-right" NavigateUrl="~/DangTin.aspx"><i class="fa fa-pencil-square-o"></i> Đăng Tin</asp:HyperLink>
                  <uc1:BVDienDan runat="server" ID="BVDienDan" />
              </div>
          </div>
        <div class="row">
          <div class="col-md-7 f-tab">
            <ul id="tabs" class="nav nav-tabs" data-tabs="tabs">
              <asp:Repeater ID="Repeater2" runat="server" DataSourceID="SqlDataSource2">
              <ItemTemplate>             
              <li class="active"><a href="#item-all" data-toggle="tab">Tất cả (<asp:Label ID="Label10" runat="server" Text='<%# Eval("IDCount") %>'></asp:Label>)</a></li>
              </ItemTemplate></asp:Repeater>
              <asp:Repeater ID="Repeater3" runat="server" DataSourceID="SqlDataSource3">
              <ItemTemplate>
              <li><a href="#canban" data-toggle="tab">Cần bán (<asp:Label ID="Label10" runat="server" Text='<%# Eval("IDCount") %>'></asp:Label>)</a></li>
              </ItemTemplate>
              </asp:Repeater>
              <asp:Repeater ID="Repeater4" runat="server" DataSourceID="SqlDataSource4">
              <ItemTemplate>
              <li><a href="#canmua" data-toggle="tab">Cần mua (<asp:Label ID="Label10" runat="server" Text='<%# Eval("IDCount") %>'></asp:Label>)</a></li>
              </ItemTemplate>
              </asp:Repeater>
            </ul>
          </div>
          <div class="col-md-2  f-title">Người Đăng</div>
          <div class="col-md-1  f-title">Xem</div>
          <div class="col-md-2 f-title">Thời Gian Đăng</div>
        </div>
        <div class="row">
          <div class="col-md-12">
            <div id="my-tab-content" class="tab-content">
              <div class="tab-pane active" id="item-all">
                <div class="col-md-12 main-content">
                  <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">
                  <ItemTemplate>
                  <div class="f-item" id='<%# Eval("IDBaiViet") %>' >
                    <div class="row f-boder" onclick="notify()">
                      <div class="col-md-7">
                        <div class="row ">
                          <div class="col-md-1 no-bookmark">
                          </div>
                          <div class="col-md-11 title">
                            <h3 style="font-weight: normal;">
                            <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("IDBaiViet", "../ChitietDienDan.aspx?matin={0}") %>' Text='<%# Eval("TieuDe").ToString().Length <= 70 ? Eval("TieuDe"):Eval("TieuDe").ToString().Substring(0, 65)+"..." %>'></asp:HyperLink>
                            </h3>
                            <p class="f-price">
                            <asp:Label ID="Label1" runat="server" Text='<%#Eval("GiaBan","{0:0,00} ₫")%>'></asp:Label>
                            </p>
                          </div>
                        </div>
                      </div>
                      <div class="col-md-2">
                        <p class="row " style="padding-top: 1px;">
                        <asp:Label ID="Label2" runat="server" Text='<%# Eval("NguoiBan") %>'></asp:Label>
                        </p>
                        <p class="row ">
                        <asp:Label ID="Label3" runat="server" Text='<%# Eval("SDT") %>'></asp:Label>
                        </p>
                      </div>
                      <div class="col-md-1">
                        <asp:Label ID="Label4" runat="server" Text='<%# Eval("LanXem") %>'></asp:Label>
                      </div>
                      <div class="col-md-2 ">
                        <asp:Label ID="Label5" runat="server" Text='<%# string.Format("{0:dd/MM/yyyy}",Eval("ThoiGianDang")) %>'></asp:Label>
                      </div>
                    </div>
                    <div class="row show-f" style="display:none" id='nd<%# Eval("IDBaiViet") %>'>
                      <div class="col-md-8">
                        <div class="row">
                          <div class="col-md-12 f-img">
                            <div class="row">
                              <div class="col-md-2">
                                <a href="#" class="f-thumbnail">
                                <asp:Image ID="Image2" runat="server" CssClass="f-imgsmall"
                                ImageUrl='<%# Eval("Img1") %>'
                                Visible='<%# Convert.ToString(Eval("Img1"))!=String.Empty %>'/>
                                
                                </a>
                              </div>
                              <div class="col-md-2">
                                <a href="#" class="f-thumbnail">
                                <asp:Image ID="Image1" runat="server" CssClass="f-imgsmall"
                                ImageUrl='<%# Eval("Img2") %>'
                                Visible='<%# Convert.ToString(Eval("Img1"))!=String.Empty %>'/>
                                
                                </a>
                              </div>
                              <div class="col-md-2">
                                <a href="#" class="f-thumbnail">
                                <asp:Image ID="Image3" runat="server" CssClass="f-imgsmall"
                                ImageUrl='<%# Eval("Img3") %>'
                                Visible='<%# Convert.ToString(Eval("Img1"))!=String.Empty %>'/>
                                
                                </a>
                              </div>
                            </div>
                          </div>
                        </div>
                        <div class="row f-content"">
                          <div class="col-md-12 " >
                            <asp:Label ID="NoiDung" runat="server" Text='<%# Eval("NoiDung") %>'></asp:Label>
                          </div>
                        </div>
                        <div class="row  f-button">
                          <div class="col-md-12 ">
                            <asp:HyperLink ID="HyperLink4" runat="server"
                            NavigateUrl='<%# Eval("IDBaiViet", "../ChitietDienDan.aspx?matin={0}") %>'
                            Text="Xem Chi Tiết" CssClass="btn btn-primary bg-bluebtn" ></asp:HyperLink>
                            <a href="#" style="color:blue;padding-left:10px;"><span>Đóng lại</span></a>
                          </div>
                        </div>
                      </div>
                      <div class="col-md-4 pull-right clearfix">
                        <div class="f-ma">
                          Mã tin:
                          <asp:Label ID="Label6" runat="server" Text='<%#Eval("IDBaiViet")%>'></asp:Label>
                        </div>
                        <div class="f-nguoidang">
                          Người đăng:
                          <asp:Label ID="Label7" runat="server" Text='<%# Eval("NguoiBan") %>'></asp:Label>
                        </div>
                        <div class="f-sdt">
                          Số Điện Thoại:
                          <strong><asp:Label ID="Label8" runat="server" Text='<%# Eval("SDT") %>'></asp:Label></strong>
                        </div>
                        <div class="f-phamvi">
                          Phạm vi rao:
                          <asp:Label ID="Label9" runat="server" Text='<%# Eval("PhamVi") %>'></asp:Label>
                        </div>
                      </div>
                    </div>
                  </div>
                  </ItemTemplate>
                  </asp:Repeater>
                </div>
              </div>
              <div class="tab-pane" id="canban">
                  <div class="col-md-12 main-content">
                  <asp:Repeater ID="Repeater5" runat="server" DataSourceID="SqlDataSource5">
                  <ItemTemplate>
                  <div class="f-itemb" id='<%# Eval("IDBaiViet") %>' >
                    <div class="row f-boder" onclick="notify()">
                      <div class="col-md-7">
                        <div class="row ">
                          <div class="col-md-1 no-bookmark">
                          </div>
                          <div class="col-md-11 title">
                            <h3 style="font-weight: normal;">
                            <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("IDBaiViet", "../ChitietDienDan.aspx?matin={0}") %>' Text='<%# Eval("TieuDe").ToString().Length <= 70 ? Eval("TieuDe"):Eval("TieuDe").ToString().Substring(0, 65)+"..." %>'></asp:HyperLink>
                            </h3>
                            <p class="f-price">
                            <asp:Label ID="Label1" runat="server" Text='<%#Eval("GiaBan","{0:0,00} ₫")%>'></asp:Label>
                            </p>
                          </div>
                        </div>
                      </div>
                      <div class="col-md-2">
                        <p class="row " style="padding-top: 1px;">
                        <asp:Label ID="Label2" runat="server" Text='<%# Eval("NguoiBan") %>'></asp:Label>
                        </p>
                        <p class="row ">
                        <asp:Label ID="Label3" runat="server" Text='<%# Eval("SDT") %>'></asp:Label>
                        </p>
                      </div>
                      <div class="col-md-1">
                        <asp:Label ID="Label4" runat="server" Text='<%# Eval("LanXem") %>'></asp:Label>
                      </div>
                      <div class="col-md-2 ">
                        <asp:Label ID="Label5" runat="server" Text='<%# string.Format("{0:dd/MM/yyyy}",Eval("ThoiGianDang")) %>'></asp:Label>
                      </div>
                    </div>
                    <div class="row show-f" style="display:none" id='ndb<%# Eval("IDBaiViet") %>'>
                      <div class="col-md-8">
                        <div class="row">
                          <div class="col-md-12 f-img">
                            <div class="row">
                              <div class="col-md-2">
                                <a href="#" class="f-thumbnail">
                                <asp:Image ID="Image2" runat="server" CssClass="f-imgsmall"
                                ImageUrl='<%# Eval("Img1") %>'
                                Visible='<%# Convert.ToString(Eval("Img1"))!=String.Empty %>'/>
                                
                                </a>
                              </div>
                              <div class="col-md-2">
                                <a href="#" class="f-thumbnail">
                                <asp:Image ID="Image1" runat="server" CssClass="f-imgsmall"
                                ImageUrl='<%# Eval("Img2") %>'
                                Visible='<%# Convert.ToString(Eval("Img1"))!=String.Empty %>'/>
                                
                                </a>
                              </div>
                              <div class="col-md-2">
                                <a href="#" class="f-thumbnail">
                                <asp:Image ID="Image3" runat="server" CssClass="f-imgsmall"
                                ImageUrl='<%# Eval("Img2") %>'
                                Visible='<%# Convert.ToString(Eval("Img1"))!=String.Empty %>'/>                               
                                </a>
                              </div>
                            </div>
                          </div>
                        </div>
                        <div class="row f-content"">
                          <div class="col-md-12 " >
                            <asp:Label ID="NoiDung" runat="server" Text='<%# Eval("NoiDung") %>'></asp:Label>
                          </div>
                        </div>
                        <div class="row  f-button">
                          <div class="col-md-12 ">
                            <asp:HyperLink ID="HyperLink4" runat="server"
                            NavigateUrl='<%# Eval("IDBaiViet", "../ChitietDienDan.aspx?matin={0}") %>'
                            Text="Xem Chi Tiết" CssClass="btn btn-primary bg-bluebtn" ></asp:HyperLink>
                            <a href="#" style="color:blue;padding-left:10px;"><span>Đóng lại</span></a>
                          </div>
                        </div>
                      </div>
                      <div class="col-md-4 pull-right clearfix">
                        <div class="f-ma">
                          Mã tin:
                          <asp:Label ID="Label6" runat="server" Text='<%#Eval("IDBaiViet")%>'></asp:Label>
                        </div>
                        <div class="f-nguoidang">
                          Người đăng:
                          <asp:Label ID="Label7" runat="server" Text='<%# Eval("NguoiBan") %>'></asp:Label>
                        </div>
                        <div class="f-sdt">
                          Số Điện Thoại:
                          <strong><asp:Label ID="Label8" runat="server" Text='<%# Eval("SDT") %>'></asp:Label></strong>
                        </div>
                        <div class="f-phamvi">
                          Phạm vi rao:
                          <asp:Label ID="Label9" runat="server" Text='<%# Eval("PhamVi") %>'></asp:Label>
                        </div>
                      </div>
                    </div>
                  </div>
                  </ItemTemplate>
                  </asp:Repeater>
                </div>
              </div>
              <div class="tab-pane" id="canmua">
                <div class="col-md-12 main-content">
                  <asp:Repeater ID="Repeater6" runat="server" DataSourceID="SqlDataSource6">
                  <ItemTemplate>
                  <div class="f-itemm" id='<%# Eval("IDBaiViet") %>' >
                    <div class="row f-boder" onclick="notify()">
                      <div class="col-md-7">
                        <div class="row ">
                          <div class="col-md-1 no-bookmark">
                          </div>
                          <div class="col-md-11 title">
                            <h3 style="font-weight: normal;">
                            <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("IDBaiViet", "../ChitietDienDan.aspx?matin={0}") %>' Text='<%# Eval("TieuDe").ToString().Length <= 70 ? Eval("TieuDe"):Eval("TieuDe").ToString().Substring(0, 65)+"..." %>'></asp:HyperLink>
                            </h3>
                            <p class="f-price">
                            <asp:Label ID="Label1" runat="server" Text='<%#Eval("GiaBan","{0:0,00} ₫")%>'></asp:Label>
                            </p>
                          </div>
                        </div>
                      </div>
                      <div class="col-md-2">
                        <p class="row " style="padding-top: 1px;">
                        <asp:Label ID="Label2" runat="server" Text='<%# Eval("NguoiBan") %>'></asp:Label>
                        </p>
                        <p class="row ">
                        <asp:Label ID="Label3" runat="server" Text='<%# Eval("SDT") %>'></asp:Label>
                        </p>
                      </div>
                      <div class="col-md-1">
                        <asp:Label ID="Label4" runat="server" Text='<%# Eval("LanXem") %>'></asp:Label>
                      </div>
                      <div class="col-md-2 ">
                        <asp:Label ID="Label5" runat="server" Text='<%# string.Format("{0:dd/MM/yyyy}",Eval("ThoiGianDang")) %>'></asp:Label>
                      </div>
                    </div>
                    <div class="row show-f" style="display:none" id='ndm<%# Eval("IDBaiViet") %>'>
                      <div class="col-md-8">
                        <div class="row">
                          <div class="col-md-12 f-img">
                            <div class="row">
                              <div class="col-md-2">
                                <a href="#" class="f-thumbnail">
                                <asp:Image ID="Image2" runat="server" CssClass="f-imgsmall"
                                ImageUrl='<%# Eval("Img1") %>'
                                Visible='<%# Convert.ToString(Eval("Img1"))!=String.Empty %>'/>                               
                                </a>
                              </div>
                              <div class="col-md-2">
                                <a href="#" class="f-thumbnail">
                                <asp:Image ID="Image1" runat="server" CssClass="f-imgsmall"
                                ImageUrl='<%# Eval("Img2") %>'
                                Visible='<%# Convert.ToString(Eval("Img1"))!=String.Empty %>'/>
                                
                                </a>
                              </div>
                              <div class="col-md-2">
                                <a href="#" class="f-thumbnail">
                                <asp:Image ID="Image3" runat="server" CssClass="f-imgsmall"
                                ImageUrl='<%# Eval("Img2") %>'
                                Visible='<%# Convert.ToString(Eval("Img1"))!=String.Empty %>'/>
                                
                                </a>
                              </div>
                            </div>
                          </div>
                        </div>
                        <div class="row f-content"">
                          <div class="col-md-12 " >
                            <asp:Label ID="NoiDung" runat="server" Text='<%# Eval("NoiDung") %>'></asp:Label>
                          </div>
                        </div>
                        <div class="row  f-button">
                          <div class="col-md-12 ">
                            <asp:HyperLink ID="HyperLink4" runat="server"
                            NavigateUrl='<%# Eval("IDBaiViet", "../ChitietDienDan.aspx?matin={0}") %>'
                            Text="Xem Chi Tiết" CssClass="btn btn-primary bg-bluebtn" ></asp:HyperLink>
                            <a href="#" style="color:blue;padding-left:10px;"><span>Đóng lại</span></a>
                          </div>
                        </div>
                      </div>
                      <div class="col-md-4 pull-right clearfix">
                        <div class="f-ma">
                          Mã tin:
                          <asp:Label ID="Label6" runat="server" Text='<%#Eval("IDBaiViet")%>'></asp:Label>
                        </div>
                        <div class="f-nguoidang">
                          Người đăng:
                          <asp:Label ID="Label7" runat="server" Text='<%# Eval("NguoiBan") %>'></asp:Label>
                        </div>
                        <div class="f-sdt">
                          Số Điện Thoại:
                          <strong><asp:Label ID="Label8" runat="server" Text='<%# Eval("SDT") %>'></asp:Label></strong>
                        </div>
                        <div class="f-phamvi">
                          Phạm vi rao:
                          <asp:Label ID="Label9" runat="server" Text='<%# Eval("PhamVi") %>'></asp:Label>
                        </div>
                      </div>
                    </div>
                  </div>
                  </ItemTemplate>
                  </asp:Repeater>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
    ConnectionString="<%$ ConnectionStrings:QLBSConnectionString %>"
    SelectCommand="SELECT *  FROM [DienDan] ORDER BY ThoiGianDang DESC"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server"
    ConnectionString="<%$ ConnectionStrings:QLBSConnectionString %>"
    SelectCommand="SELECT count(*) as IDCount  FROM [DienDan] WHERE (DaBan = 'false')"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource3" runat="server"
    ConnectionString="<%$ ConnectionStrings:QLBSConnectionString %>"
    SelectCommand="SELECT count(*) as IDCount  FROM [DienDan] WHERE (DaBan = 'false') and (TheLoai ='true')"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource4" runat="server"
    ConnectionString="<%$ ConnectionStrings:QLBSConnectionString %>"
    SelectCommand="SELECT count(*) as IDCount  FROM [DienDan] WHERE (DaBan = 'false') and (TheLoai ='false')"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource5" runat="server"
    ConnectionString="<%$ ConnectionStrings:QLBSConnectionString %>"
    SelectCommand="SELECT *  FROM [DienDan] WHERE (DaBan = 'false') and (TheLoai ='true')"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource6" runat="server"
    ConnectionString="<%$ ConnectionStrings:QLBSConnectionString %>"
    SelectCommand="SELECT *  FROM [DienDan] WHERE (TheLoai ='False')"></asp:SqlDataSource>
    </asp:Content>
    